package com.xiao.sulingproduct.fegin;

import com.xiao.sulingproduct.vo.CommodityVo;
import com.xiao.sulingpublic.to.BusinessTo;
import com.xiao.sulingpublic.to.ClassifyEsTo;
import com.xiao.sulingpublic.to.ShopEsTo;
import com.xiao.sulingpublic.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

/**
 * @author: 1322127758@qq.com
 * @date: 2022/3/20 11:27
 * @作用:
 */
@FeignClient("suling-es")
public interface EsFeign {
    /**
     * 将商品数据保存到es中
     * @param commodityVo
     * @return
     */
    @PostMapping("/es/product/save")
    R save(@RequestBody CommodityVo commodityVo);

    /**
     * 删除商品数据
     */
    @RequestMapping("/es/product/delete")
    R delete(@RequestParam("coId") Long coId);

    /**
     * 修改数据
     */
    @RequestMapping("/es/product/update")
    R update(@RequestBody CommodityVo commodityVo);

    /**
     * 查询全部
     */
    @PostMapping("/es/product/list")
    R list(@RequestBody ClassifyEsTo classifyEsTo) throws IOException;


    /**
     * 获取附近店铺集合
     * @param    shopEsTo 经度 纬度 距离（千米）
     **/
    @RequestMapping("/es/shop/list")
    R selectByLatAndLon(@RequestBody ShopEsTo shopEsTo)throws IOException;

    /**
     * 将商品数据保存到es中
     * @param businessTo :要保存的商品数据
     * @return
     */
    @PostMapping("/es/shop/save")
    R save(@RequestBody BusinessTo businessTo) throws IOException;
}
